using ll = long long;
class Solution {
public:
    int distanceBetweenBusStops(vector<int>& distance, int start, int destination) {
        ll num1 = 0, num2 = 0;
        int begin = start, end = destination, size = distance.size();
        while (begin != end) {
            num1 += distance[begin];
            begin++;
            begin = begin % size;
        }
        end = start;
        while (begin != end) {
            num2 += distance[begin];
            begin++;
            begin = begin % size;
        }
        return min(num1, num2);
    }
};